<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>04_JS流程控制</title>
</head>
<body>
<script>
    //顺序结构
    console.log(1);
    console.log(2);
    console.log(3);

    //分支结构
    let uname='tt';
    if(!uname){
        // alert('请先登录！')
    }else{
        // alert('登录成功！欢迎'+uname+'回归！')
    }

    //循环结构
    let gender=10;
    switch (gender){
        case 1:
            console.log('你是男生！');
            break;
        case 0:
            console.log('你是女生！');
            break;
        default:
            console.log('你是外星人！');
            break;
    }

    let names=['张三','李四','王五'];
    for(var i=0;i<names.length;i++){
        console.log(names[i]);
    }
    console.log('循环结束！');
    console.log(i);

    //增强for循环
    for(let name of names){
        console.log(name);
    }
</script>
</body>
</html>